package com.zc.im.mapper.customer;

import com.zc.im.model.customer.ZcCustomerServiceRelation;
import com.zc.im.model.customer.ZcCustomerServiceRelationExample;
import com.zc.im.model.customer.ZcCustomerServiceRelationKey;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;

public interface ZcCustomerServiceRelationMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_customer_service_relation
     *
     * @mbggenerated
     */
    int countByExample(ZcCustomerServiceRelationExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_customer_service_relation
     *
     * @mbggenerated
     */
    int deleteByExample(ZcCustomerServiceRelationExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_customer_service_relation
     *
     * @mbggenerated
     */
    @Delete({
        "delete from zc_customer_service_relation",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(ZcCustomerServiceRelationKey key);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_customer_service_relation
     *
     * @mbggenerated
     */
    @Insert({
        "insert into zc_customer_service_relation (id, user_id, ",
        "customer_service_user_id, customer_service_type, ",
        "created_time, updated_time, ",
        "status)",
        "values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, ",
        "#{customerServiceUserId,jdbcType=INTEGER}, #{customerServiceType,jdbcType=VARCHAR}, ",
        "#{createdTime,jdbcType=TIMESTAMP}, #{updatedTime,jdbcType=TIMESTAMP}, ",
        "#{status,jdbcType=VARCHAR})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=true, resultType=Integer.class)
    int insert(ZcCustomerServiceRelation record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_customer_service_relation
     *
     * @mbggenerated
     */
    int insertSelective(ZcCustomerServiceRelation record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_customer_service_relation
     *
     * @mbggenerated
     */
    List<ZcCustomerServiceRelation> selectByExample(ZcCustomerServiceRelationExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_customer_service_relation
     *
     * @mbggenerated
     */
    @Select({
        "select",
        "id, user_id, customer_service_user_id, customer_service_type, created_time, ",
        "updated_time, status",
        "from zc_customer_service_relation",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("BaseResultMap")
    ZcCustomerServiceRelation selectByPrimaryKey(ZcCustomerServiceRelationKey key);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_customer_service_relation
     *
     * @mbggenerated
     */
    int updateByExampleSelective(@Param("record") ZcCustomerServiceRelation record, @Param("example") ZcCustomerServiceRelationExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_customer_service_relation
     *
     * @mbggenerated
     */
    int updateByExample(@Param("record") ZcCustomerServiceRelation record, @Param("example") ZcCustomerServiceRelationExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_customer_service_relation
     *
     * @mbggenerated
     */
    int updateByPrimaryKeySelective(ZcCustomerServiceRelation record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table zc_customer_service_relation
     *
     * @mbggenerated
     */
    @Update({
        "update zc_customer_service_relation",
        "set user_id = #{userId,jdbcType=INTEGER},",
          "customer_service_user_id = #{customerServiceUserId,jdbcType=INTEGER},",
          "customer_service_type = #{customerServiceType,jdbcType=VARCHAR},",
          "created_time = #{createdTime,jdbcType=TIMESTAMP},",
          "updated_time = #{updatedTime,jdbcType=TIMESTAMP},",
          "status = #{status,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(ZcCustomerServiceRelation record);
}